package com.hzw.service.impl;

import com.hzw.config.DatabaseContextHolder;
import com.hzw.mapper.CityMapper;
import com.hzw.model.City;
import com.hzw.service.CityService;
import com.hzw.util.DbUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 城市业务层接口实现类
 */
@Service
public class CityServiceImpl implements CityService {

    @Autowired
    private CityMapper cityMapper;

    @Override
    public List<City> findCity() {
        // 指定数据源
        DatabaseContextHolder.setDBKey(DbUtil.DB_BASE);
        return cityMapper.findCity();
    }
}
